#include <soar.h>

#define THRD_NUM        5

struct thrd_ctl
{
    unsigned long thrd_id;
    int thrd_index;
};
struct thrd_ctl a_thrd_ctl[THRD_NUM];


void thrd_listener(struct thrd_ctl *thrd_ctl)
{
    printf("thrd(%d): hello\n", thrd_ctl->thrd_index);
}


int main()
{
    int i;

    for(i=0; i<THRD_NUM; i++)
    {
        a_thrd_ctl[i].thrd_index=i;
        if(thrd_create((THRD_FUNC_T)thrd_listener, &a_thrd_ctl[i],
                    THRD_DETACH, &a_thrd_ctl[i].thrd_id))
        {
            printf("create thrd(%d) fail\n", i);
            return(-1);
        }
    }

    sleep(5);
    return(0);
}
